﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Admin_Web_test.Kit;
using Admin_Web_test.Models;
using Common.DBHelp;
using Common.Utility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace Admin_Web_test.Controllers
{
    [PowerActionFilter]
    public class AdminController : Controller
    {
        private readonly Common.DBHelp.MySqlContext _context;

        public AdminController(Common.DBHelp.MySqlContext context)
        {
            //https://www.cnblogs.com/yaopengfei/p/12194230.html   5.6
            context.ChangeTracker.QueryTrackingBehavior = Microsoft.EntityFrameworkCore.QueryTrackingBehavior.NoTracking;
            //关闭状态同步
            context.ChangeTracker.AutoDetectChangesEnabled = false;
            //开启：context.ChangeTracker.DetectChanges();
            _context = context;
        }
        public IActionResult Index()
        {
            var user = HttpContext.Session.Get<Sysuser>(SessionKeysM.Login);
            if (user == null || user.Id.ToString().ToInt() == 0) return Redirect("/home/login");
            return View();
        }
        public IActionResult Index2()
        {
            return View();
        }
    }
}